In a conventional picture data compression-encoding system, picture data is quantized in the unit of one block that is composed of a predetermined number of pixels. For example, in the MPEG2 (Moving Pictures Experts Group 2), such a compression-encoding system is used. In the MPEG2, picture data is transformed in the unit of one block that is composed of a plurality of pixels by the DCT (Discrete Cosine Transform) method. The obtained DCT coefficients are quantized. As a result, the picture data has been compression-encoded. In the MPEG2, a quantizer step is designated with a quantizer scale.
In a conventional picture quality optimizing method using the compression-encoding of the MPEG2, an activity that is a coefficient that represents the complexity and smoothness of a picture to be compressed is calculated. With an adaptive quantization based on the activity, the picture quality is optimized.
This method is performed as follows. In a simple and smooth picture region, when the compressing process is performed, the deterioration of the picture quality is remarkable. In this region (referred to as plane region), the picture data is finely quantized with a quantizer scale whose quantizer step is small. In contrast, in a complicated picture region, when the compressing process is performed, the deterioration of the picture quality is not remarkable. In this region, the picture data is coarsely quantized with a quantizer scale whose quantizer step is large. Thus, with a limited code amount, the picture quality can be effectively optimized.
When picture data is compressed, as described above, each picture region is divided into pixel blocks each having a predetermined size. The picture data is quantized and DCT-transformed in the unit of one pixel block. The MPEG2 standard prescribes a block of eight pixels×eight lines as the minimum process unit. In addition, the MPEG2 standard prescribes that each block of eight pixels×eight lines should be DCT-transformed and that the resultant DCT coefficients are quantized in the unit of a macro block of 16 pixels×16 lines.
On the other hand, although the MPEG2 standard does not clearly prescribe the unit for calculating the forgoing activity, however, the MPEG2 TM5 (Test Model 5) has proposed that the activity should be processed in the unit of one sub block of eight pixels×eight lines, which is the same as one DCT block.
Next, the activity calculating method in “adaptive quantization considering visual characteristic” that has been proposed in the MPEG2 TM5 will be described.
The adaptive quantization is to vary a quantizer scale Qj that depends on the state of a picture with an activity of each macro block so as to control the generated code amount of for example one frame and improve the picture quality. The quantizer scale Qj is varied with the activity so that in a plane region, where the deterioration of the picture quality is remarkable, the picture data is quantized with the quantizer scale Qj whose quantizer step is small and in a complicated picture region, where the deterioration of the picture quality is not remarkable, the picture data is quantized with the quantizer scale Qj whose quantizer step is large.
The activity is obtained with pixel values of a luminance signal of an original picture rather than a predictively error. In other words, the activity is obtained by calculating the following Formulas (1) to (3) in the reverse order for the j-th macro block with four blocks of the frame DCT encoding mode and four blocks of the field DCT encoding mode.actj=1+min [sblk=1, 8](var—sblk)  (1)var—sblk=1/64Σ[k=1, 64](Pk−Pavg)2  (2)Pavg=1/64Σ[k=1, 64]Pk  (3)
where Pk is a pixel value of a block of a luminance signal of the original picture. In Formula (3), 64 pixel values of a block of 8×8 are summed and the result is divided by 64. As a result, the average value Pavg of the pixel values is obtained. Next, in Formula (2), the difference between the average value Pavg and Pk is obtained. As a result, the average difference value var_sblk of the block of 8×8 is calculated. In Formula (1), with the minimum value of the average difference values var_sblk, the activity actj of the macro block is obtained. The minimum value is used because even if a part of the macro block contains a plain portion, it is necessary to finely quantize the macro block.
As described above, in the MPEG2 MT5, an activity is calculated for each sub block composed of eight pixels×eight lines, which is the same as one DCT block. The minimum activity of the activities of eight sub block is selected. The selected minimum activity is determined as the activity of the macro block.
This method is effective when the compression rate is high and the code amount is not affordable. However, when the compression rate is low and the code amount is relatively affordable, if this method is simply applied, since the picture quality is high, so-called mosquito noise becomes remarkable when a macro block contains even a small plain region.
Now, the mosquito noise will be described in brief. When high frequency components of DCT coefficients are coarsely quantized, at an edge portion 10A of an object 10 on a screen shown in FIG. 1A, ringing 11 shown in FIG. 1B takes place. When the edge portion 10A of the object 10 moves, since the separating method for a DCT block 12 varies. As a result, the state of the ringing 11 varies, which looks like a mosquito flies around the edge portion 10A. Thus, this phenomenon is called mosquito noise. When the periphery of the edge portion 10A is a plane region, the mosquito noise takes place very much.
As described above, when the entire picture is in high quality, if mosquito noise takes place in a plane region, the mosquito noise becomes more remarkable. Thus, when the compression rate is low-namely the code amount is affordable, it is very effective to cause a quantizer scale Qj of a macro block that contains even a small plain region to have a finer quantizer step.
Therefore, an object of the present invention is to provide a picture processing apparatus, a picture processing method, a picture processing program, and a recording medium that suppress the occurrence of mosquito noise in a macro block that contains even a small plain region.